function initButtonCss(btnArray, overCss,downCss,outCss) {
  function mouseover(event) {
    var elem = Event.element(event);
    elem.className = overCss;
  }

  function mousedown(event) {
    var elem = Event.element(event);
    elem.className = downCss;
  }
  function mouseout(event) {
    var elem = Event.element(event);
    elem.className = outCss;
  }

  btnArray.each(function(btn) {
    btn.className = outCss;
    Event.observe(btn, 'mouseover', mouseover);
    Event.observe(btn, 'mousedown', mousedown);
    Event.observe(btn, 'mouseout', mouseout);
  });
}

function initTextInputHint(textArray, str) {
  function inputFocus(str){
    return function(event) {
      var elem = Event.element(event);
      if (elem.value == str){
        elem.value = "";		
      }
    }
  }

  function inputBlur(str){
    return function(event) {
      var elem = Event.element(event);
      if (elem.value == ""){
        elem.value = str;
      }
    }
  }

  textArray.each(function(btn) {
    Event.observe(btn, 'focus', inputFocus(str));
    Event.observe(btn, 'blur', inputBlur(str));
  });
}

function initZebraTable(tableId) {
  function mouseover(ele) {
    return function(event) {
      ele.className = "trmouseover";
    }
  }
  function mouseout(ele,className) {
    return function(event) {
      ele.className = className;
    }
  }
  $$('table#'+tableId+' tbody > tr:nth-child(odd)').each(function(ele) {
    ele.className = 'trsingle';
    ele.observe("mouseover", mouseover(ele));
    ele.observe("mouseout", mouseout(ele,"trsingle"));
  });
  $$('table#'+tableId+' tbody > tr:nth-child(even)').each(function(ele) {
    ele.addClassName('trdual');
    ele.observe("mouseover", mouseover(ele));
    ele.observe("mouseout", mouseout(ele,"trdual"));
  });
}

function clearActionError(ele) {
  if (ele.getAttribute('fielderror')) {
    if (ele.ragName == 'SELECT') {
      ele.style.color = '';
    } else {
      ele.style.borderColor = '';
    }
    ele.removeAttribute('fielderror');
  }
}

